const express = require('express');
const compression = require('compression');
const path = require('path');
const port = 4002;
const app = express();

app.use(compression());//gzip压缩

const map = {
  '/a': 'server.js',
  '/b': 'server2.js',
  '/c': '../image/example.png',
};

for (let key in map) {
  app.use(key, express.static(path.join(__dirname, `./${map[key]}`)));
}
app.get('/', (req, res) => res.send('Hello server2!'));

app.listen(port, () => {
  console.info(`server started in http://localhost:${port}`);
});
